package com.baturu.vin.dfpv.dal.dao;

import com.baturu.vin.dfpv.dto.DfpvVinDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: chenjiahao
 * @Time: 2018/8/29
 */
public interface DfpvVinDAO {

    @Insert({"insert into dfpv_vin_query_result(",
            "vinCode,",
            "btrBrand,",
            "btrSubBrand,",
            "carSystem,",
            "carType,",
            "vehicleType,",
            "vehicleLevel,",
            "bodyModel,",
            "Vcode,",
            "EngineType,",
            "Displacement,",
            "AirIntake,",
            "TransmissionType,",
            "TransmissionDesc,",
            "BTRTransmissionType,",
            "GearsNum,",
            "DoorNumber,",
            "Country,",
            "ProductTime,",
            "MJ,",
            "Chassis,",
            "DriveType,",
            "DriveMode,",
            "Seats,",
            "ShowCarType,",
            "SalesName,",
            "GuidingPrice",
            ") values(",
            "#{dto.vinCode},",
            "#{dto.btrBrand},",
            "#{dto.btrSubBrand},",
            "#{dto.carSystem},",
            "#{dto.carType},",
            "#{dto.vehicleType},",
            "#{dto.vehicleLevel},",
            "#{dto.bodyModel},",
            "#{dto.vcode},",
            "#{dto.engineType},",
            "#{dto.displacement},",
            "#{dto.airIntake},",
            "#{dto.transmissionType},",
            "#{dto.transmissionDesc},",
            "#{dto.btrTransmissionType},",
            "#{dto.gearsNum},",
            "#{dto.doorNumber},",
            "#{dto.country},",
            "#{dto.productTime},",
            "#{dto.mj},",
            "#{dto.chassis},",
            "#{dto.driveType},",
            "#{dto.driveMode},",
            "#{dto.seats},",
            "#{dto.showCarType},",
            "#{dto.salesName},",
            "#{dto.guidingPrice}",
            ")"})
    @Options(useGeneratedKeys = true, keyProperty = "dto.id")
    int insert(@Param("dto") DfpvVinDTO vinModelDTO);

    @Select("select * from Dfpv_vin_query_result where vinCode = #{vinCode}")
    DfpvVinDTO findVinModel(@Param("vinCode") String vinCode);

}
